package foo.bar.forum.web.extension;

import foo.bar.forum.domain.Resource;
import foo.bar.forum.services.ForumService;
import foo.bar.forum.domain.Resource;
import net.sourceforge.stripes.validation.ValidationError;
import net.sourceforge.stripes.integration.spring.SpringBean;

import java.util.Collection;

/**
 * Created by IntelliJ IDEA.
 * User: 1269870
 * Date: Apr 30, 2009
 * Time: 12:09:51 PM
 * To change this template use File | Settings | File Templates.
 */
public class ResourceTypeConverter extends AbstractIdentifiableTypeConverter<Resource> {

    private ForumService forumService;

    protected Resource _convert(String id, Class<? extends Resource> targetType,
                                Collection<ValidationError> errors) {
        return forumService.getResourceById(id);
    }


    @SpringBean("forumService")
    public void setForumService(ForumService wikiService) {
        this.forumService = wikiService;
    }


}
